home *** CD-ROM | disk | FTP | other *** search
- {$M+}
- {$E+}
- {******************************************************************}
- {* This program is to be linked with PICPUZZL.PAS. These are *}
- {* the routines needed to do the raster operations. *}
- {******************************************************************}
-
- program addr_stuff;
-
- const
- low_resolution = 1 ;
- medium_resolution = 2 ;
- high_resolution = 3 ;
-
- type
- {* These are echos of types in PICPUZZL.PAS *}
- scrn_memory = array[1..16000] of integer;
- mfdb_fields = (addr1,addr2,wid_pix,ht_pix,wid_wds,flag,num_planes,r1,r2,r3);
- mfdb = array[mfdb_fields] of integer;
-
- PROCEDURE init_form(var form : MFDB; addr : long_integer; res: integer);
- { initializes a form to point to a chunk of memory off screen }
- { note that the caller passes a 32K chunk of memory as what it
- thinks is a var parameter, thus passing its address }
- var
- hi_byte,lo_byte : integer;
-
- begin
- { convert the address to integers }
- lo_byte := int(addr & $0000ffff);
- hi_byte := int( ShR(addr,16) & $0000ffff);
- { and initialize all fields of the MFDB }
- form[addr1] := hi_byte;
- form[addr2] := lo_byte;
- IF res = high_resolution THEN
- BEGIN
- form[wid_pix] := 640 ;
- form[ht_pix] := 400 ;
- form[wid_wds] := 40 ;
- form[num_planes] := 1 ;
- END
- ELSE
- IF res = medium_resolution THEN
- BEGIN
- form[wid_pix] := 640 ;
- form[ht_pix] := 200 ;
- form[wid_wds] := 40 ;
- form[num_planes] := 2 ;
- END
- ELSE
- BEGIN
- form[wid_pix] := 320 ;
- form[ht_pix] := 200 ;
- form[wid_wds] := 20 ;
- form[num_planes] := 4 ;
- END ;
- form[flag] := 0; { device dependent }
- end;
-
- PROCEDURE copy_rect(src,dst : long_integer;
- from_x,from_y,to_x,to_y,width,height : integer);
- { heres where we actually copy a rectangle from one loc. to another }
- { using gem raster copy function }
-
- TYPE
- Ctrl_Parms = ARRAY [ 0..11 ] OF integer ;
- Int_In_Parms = ARRAY [ 0..15 ] OF integer ;
- Int_Out_Parms = ARRAY [ 0..45 ] OF integer ;
- Pts_In_Parms = ARRAY [ 0..11 ] OF integer ;
- Pts_Out_Parms = ARRAY [ 0..11 ] OF integer ;
-
- VAR
- control : Ctrl_Parms ;
- int_in : Int_In_Parms ;
- int_out : Int_Out_Parms ;
- pts_in : Pts_In_Parms ;
- pts_out : Pts_Out_Parms ;
-
- hi_byte,lo_byte : integer;
-
-
- PROCEDURE VDI_Call( cmd, sub_cmd : integer ; nints, npts : integer ;
- VAR ctrl : Ctrl_Parms ;
- VAR int_in : Int_In_Parms ; VAR int_out : Int_Out_Parms ;
- VAR pts_in : Pts_In_Parms ; VAR pts_out : Pts_Out_Parms ;
- translate : boolean ) ;
- EXTERNAL ;
-
-
- begin
- { put source MFDB address in control array }
- lo_byte := int(src & $0000ffff);
- hi_byte := int( ShR(src,16) & $0000ffff);
- control[7] := hi_byte; control[8] := lo_byte;
-
- { and same for destination MFDB }
- lo_byte := int(dst & $0000ffff);
- hi_byte := int( ShR(dst,16) & $0000ffff);
- control[9] := hi_byte; control[10] := lo_byte;
-
- int_in[0] := 3; { replace mode }
-
- { set the points for src and dest }
- pts_in[0] := from_x; pts_in[1] := from_y;
- pts_in[2] := from_x + width - 1;
- pts_in[3] := from_y + height - 1;
-
- pts_in[4] := to_x; pts_in[5] := to_y;
- pts_in[6] := to_x + width - 1;
- pts_in[7] := to_y + height - 1;
-
- { do the copy }
- VDI_Call(109,0,1,8,control,int_in,int_out,pts_in,pts_out,false);
-
- end;
-
- { just a module, no main program }
- begin
- end.
-
-